package com.ybkj.o2o.zhuanche.service.impl;

import com.ybkj.o2o.zhuanche.common.query.CarTypeCompanyQuery;
import com.ybkj.o2o.zhuanche.entity.CarTypeCompany;
import com.ybkj.o2o.zhuanche.entity.CarTypeCompanyCriteria;
import com.ybkj.o2o.zhuanche.mapper.BaseMapper;
import com.ybkj.o2o.zhuanche.mapper.CarTypeCompanyMapper;
import com.ybkj.o2o.zhuanche.service.CarTypeCompanyService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class DefaultCarTypeCompanyService extends
    AbstractBaseService<CarTypeCompany, CarTypeCompanyCriteria, Long> implements
    CarTypeCompanyService {

  @Autowired
  private CarTypeCompanyMapper carTypeCompanyMapper;

  @Override
  public BaseMapper<CarTypeCompany, CarTypeCompanyCriteria, Long> getMapper() {
    return carTypeCompanyMapper;
  }

  @Override
  public int insert(CarTypeCompany carTypeCompany) {
    carTypeCompany.setCreated(new Date());
    carTypeCompany.setUpdated(new Date());
    return super.insert(carTypeCompany);
  }

  @Override
  public List<CarTypeCompany> findByCompanyIdAndCarTypeId(CarTypeCompanyQuery carTypeCompanyQuery) {
    return carTypeCompanyMapper.findByCompanyIdAndCarTypeId(carTypeCompanyQuery);
  }

  @Override
  public Long countByCarTypeId(CarTypeCompanyQuery carTypeCompanyQuery) {
    return carTypeCompanyMapper.countByCarTypeId(carTypeCompanyQuery);
  }

  @Override
  public Long deleteByCarTypeId(Long carTypeId, String appKey) {
    return carTypeCompanyMapper.deleteByCarTypeId(carTypeId,appKey);
  }

  @Override
  public List<CarTypeCompany> countType(Long companyId, String appKey) {
    return carTypeCompanyMapper.countType(companyId,appKey);
  }

}
